package org.noip.milhous;

import java.math.BigInteger;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;

import org.noip.milhous.annotations.dbVar;
import org.noip.milhous.annotations.length;
import org.noip.milhous.annotations.transientVar;

public class TABLES extends DatabaseRow implements CustomFieldMapping, TableNameMapping
{
	@transientVar
	public static String tableName;

	@transientVar
	public static Map<String, String> fieldNameMapping = new HashMap<String, String>();

	public enum FIELDS
	{
		TABLE_CATALOG("TABLE_CATALOG"), TABLE_SCHEMA("TABLE_SCHEMA"), TABLE_NAME("TABLE_NAME"), TABLE_TYPE("TABLE_TYPE"), ENGINE("ENGINE"), VERSION("VERSION"), ROW_FORMAT("ROW_FORMAT"), TABLE_ROWS(
				"TABLE_ROWS"), AVG_ROW_LENGTH("AVG_ROW_LENGTH"), DATA_LENGTH("DATA_LENGTH"), MAX_DATA_LENGTH("MAX_DATA_LENGTH"), INDEX_LENGTH("INDEX_LENGTH"), DATA_FREE("DATA_FREE"), AUTO_INCREMENT(
				"AUTO_INCREMENT"), CREATE_TIME("CREATE_TIME"), UPDATE_TIME("UPDATE_TIME"), CHECK_TIME("CHECK_TIME"), TABLE_COLLATION("TABLE_COLLATION"), CHECKSUM("CHECKSUM"), CREATE_OPTIONS(
				"CREATE_OPTIONS"), TABLE_COMMENT("TABLE_COMMENT");
		public String dbField;

		private FIELDS(String s)
			{
				dbField = s;
			}

		public String getDatabaseFieldName()
			{
				return "`" + dbField + "`";
			}

	}

	static
		{
			tableName = "TABLES";
			for (FIELDS f : FIELDS.values())
				{
					fieldNameMapping.put(f.name(), f.getDatabaseFieldName().replace("`", ""));
				}

		}

	public TABLES()
		{
			super();
		}

	@dbVar
	@length("512")
	private String TABLE_CATALOG = null;

	@dbVar
	@length("64")
	private String TABLE_SCHEMA = null;

	@dbVar
	@length("64")
	private String TABLE_NAME = null;

	@dbVar
	@length("64")
	private String TABLE_TYPE = null;

	@dbVar
	@length("64")
	private String ENGINE = null;

	@dbVar
	private BigInteger VERSION = null;

	@dbVar
	@length("10")
	private String ROW_FORMAT = null;

	@dbVar
	private BigInteger TABLE_ROWS = null;

	@dbVar
	private BigInteger AVG_ROW_LENGTH = null;

	@dbVar
	private BigInteger DATA_LENGTH = null;

	@dbVar
	private BigInteger MAX_DATA_LENGTH = null;

	@dbVar
	private BigInteger INDEX_LENGTH = null;

	@dbVar
	private BigInteger DATA_FREE = null;

	@dbVar
	private BigInteger AUTO_INCREMENT = null;

	@dbVar
	private Calendar CREATE_TIME = null;

	@dbVar
	private Calendar UPDATE_TIME = null;

	@dbVar
	private Calendar CHECK_TIME = null;

	@dbVar
	@length("64")
	private String TABLE_COLLATION = null;

	@dbVar
	private BigInteger CHECKSUM = null;

	@dbVar
	@length("255")
	private String CREATE_OPTIONS = null;

	@dbVar
	@length("80")
	private String TABLE_COMMENT = null;

	public String getTABLE_CATALOG()
		{
			return TABLE_CATALOG;
		}

	public void setTABLE_CATALOG(String table_catalog)
		{
			this.TABLE_CATALOG = table_catalog;
		}

	public String getTABLE_SCHEMA()
		{
			return TABLE_SCHEMA;
		}

	public void setTABLE_SCHEMA(String table_schema)
		{
			this.TABLE_SCHEMA = table_schema;
		}

	public String getTABLE_NAME()
		{
			return TABLE_NAME;
		}

	public void setTABLE_NAME(String table_name)
		{
			this.TABLE_NAME = table_name;
		}

	public String getTABLE_TYPE()
		{
			return TABLE_TYPE;
		}

	public void setTABLE_TYPE(String table_type)
		{
			this.TABLE_TYPE = table_type;
		}

	public String getENGINE()
		{
			return ENGINE;
		}

	public void setENGINE(String engine)
		{
			this.ENGINE = engine;
		}

	public BigInteger getVERSION()
		{
			return VERSION;
		}

	public void setVERSION(BigInteger version)
		{
			this.VERSION = version;
		}

	public String getROW_FORMAT()
		{
			return ROW_FORMAT;
		}

	public void setROW_FORMAT(String row_format)
		{
			this.ROW_FORMAT = row_format;
		}

	public BigInteger getTABLE_ROWS()
		{
			return TABLE_ROWS;
		}

	public void setTABLE_ROWS(BigInteger table_rows)
		{
			this.TABLE_ROWS = table_rows;
		}

	public BigInteger getAVG_ROW_LENGTH()
		{
			return AVG_ROW_LENGTH;
		}

	public void setAVG_ROW_LENGTH(BigInteger avg_row_length)
		{
			this.AVG_ROW_LENGTH = avg_row_length;
		}

	public BigInteger getDATA_LENGTH()
		{
			return DATA_LENGTH;
		}

	public void setDATA_LENGTH(BigInteger data_length)
		{
			this.DATA_LENGTH = data_length;
		}

	public BigInteger getMAX_DATA_LENGTH()
		{
			return MAX_DATA_LENGTH;
		}

	public void setMAX_DATA_LENGTH(BigInteger max_data_length)
		{
			this.MAX_DATA_LENGTH = max_data_length;
		}

	public BigInteger getINDEX_LENGTH()
		{
			return INDEX_LENGTH;
		}

	public void setINDEX_LENGTH(BigInteger index_length)
		{
			this.INDEX_LENGTH = index_length;
		}

	public BigInteger getDATA_FREE()
		{
			return DATA_FREE;
		}

	public void setDATA_FREE(BigInteger data_free)
		{
			this.DATA_FREE = data_free;
		}

	public BigInteger getAUTO_INCREMENT()
		{
			return AUTO_INCREMENT;
		}

	public void setAUTO_INCREMENT(BigInteger auto_increment)
		{
			this.AUTO_INCREMENT = auto_increment;
		}

	public Calendar getCREATE_TIME()
		{
			return CREATE_TIME;
		}

	public void setCREATE_TIME(Calendar create_time)
		{
			this.CREATE_TIME = create_time;
		}

	public Calendar getUPDATE_TIME()
		{
			return UPDATE_TIME;
		}

	public void setUPDATE_TIME(Calendar update_time)
		{
			this.UPDATE_TIME = update_time;
		}

	public Calendar getCHECK_TIME()
		{
			return CHECK_TIME;
		}

	public void setCHECK_TIME(Calendar check_time)
		{
			this.CHECK_TIME = check_time;
		}

	public String getTABLE_COLLATION()
		{
			return TABLE_COLLATION;
		}

	public void setTABLE_COLLATION(String table_collation)
		{
			this.TABLE_COLLATION = table_collation;
		}

	public BigInteger getCHECKSUM()
		{
			return CHECKSUM;
		}

	public void setCHECKSUM(BigInteger checksum)
		{
			this.CHECKSUM = checksum;
		}

	public String getCREATE_OPTIONS()
		{
			return CREATE_OPTIONS;
		}

	public void setCREATE_OPTIONS(String create_options)
		{
			this.CREATE_OPTIONS = create_options;
		}

	public String getTABLE_COMMENT()
		{
			return TABLE_COMMENT;
		}

	public void setTABLE_COMMENT(String table_comment)
		{
			this.TABLE_COMMENT = table_comment;
		}

	@Override
	public String toString()
		{
			return " " + TABLE_CATALOG + " " + TABLE_SCHEMA + " " + TABLE_NAME + " " + TABLE_TYPE + " " + ENGINE + " " + VERSION + " " + ROW_FORMAT + " " + TABLE_ROWS + " " + AVG_ROW_LENGTH + " " + DATA_LENGTH + " " + MAX_DATA_LENGTH + " " + INDEX_LENGTH + " " + DATA_FREE + " " + AUTO_INCREMENT + " " + CREATE_TIME + " " + UPDATE_TIME + " " + CHECK_TIME + " " + TABLE_COLLATION + " " + CHECKSUM + " " + CREATE_OPTIONS + " " + TABLE_COMMENT + " ";
		}

	public String getRealTableName()
		{
			return tableName;
		}

	public String getJavaToDbMapping(String s)
		{
			return fieldNameMapping.get(s);
		}
}
